home *** CD-ROM | disk | FTP | other *** search
/ MacGames Sampler / PHT MacGames Bundle.iso / MacSource Folder / Samples from the CD / Assembly / Mac68k / MANUAL / MAN3.DOC < prev    next >
Encoding:
Text File  |  1985-08-20  |  13.4 KB  |  468 lines  |  [TEXT/Anon]

  1.  
  2. MAC.68K
  3.  
  4.  
  5.   II.11 ASCII Control Characters  II.11 ASCII Control Characters  II.11 ASCII Control Characters
  6.  
  7.  
  8.       Any ASCII control characters found in the source input will
  9.   be converted to # prior to processing except for:  CR ($0D), LF
  10.   ($0A), DLE ($10), and HT ($09) (see II.4).
  11.  
  12.  
  13.   II.12 Numeric Data Representation  II.12 Numeric Data Representation  II.12 Numeric Data Representation
  14.  
  15.  
  16.       Hex numbers begin with the symbol $, octal numbers use a
  17.   postfix radix character of B or Q, and decimal numbers may
  18.   optionally use a radix of D.  Radix and hex alpha characters may
  19.   be any mixture of upper and/or lower case.
  20.       All numbers are represented internally as 32-bit integers.
  21.   This places a range limit of +2**31 - 1 on the value of any                               _
  22.   number.
  23.  
  24.    Examples       DECIMAL     OCTAL         HEX
  25.  
  26.    unsigned          18          7Q        $1AF
  27.    signed          -123D       -77Q        -$30
  28.                      +5        +03Q        +$FF
  29.  
  30.  
  31.   II.13 Character Data Representation  II.13 Character Data Representation  II.13 Character Data Representation
  32.  
  33.  
  34.       Character data may be defined by placing the desired
  35.   character string within single quotes. (Double quotes are used
  36.   for STRING names.)
  37.  
  38.       MAC.68K also supports a variety of left and right justified
  39.   character data types. Justification occurs when the specified
  40.   character data is shorter than its field. For example one byte of
  41.   data in a word field, or 21 bytes in a 6 long word field will be
  42.   aligned to a left or right field boundary.  Space and zero fill
  43.   are available options.
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.                               -7-                               MAC.68K
  65.                                                                 MAC.68K
  66.  
  67.  
  68.       The general form for justified character data is:
  69.  
  70.          n / type / string
  71.  
  72.       A special form available for DC operations only is:
  73.  
  74.          #type / d / string / d
  75.  
  76.          where  n  is the field size and  d  is any character
  77.  
  78.  
  79.           type             description
  80.  
  81.            A               Right justified with blank fill
  82.            H               Left justified with blank fill
  83.            L               Left justified with zero fill
  84.            R               Right justified with zero fill
  85.            Z               Left justified with zero fill. For DC
  86.                            instructions, one trailing zero byte
  87.                            is guaranteed even if another byte, word,
  88.                            or long word must be allocated. Within
  89.                            an expression or constant, type Z is
  90.                            equivalent to type L.
  91.  
  92.       Each character data type may either have an explicit
  93.   character length or may use delimiter characters to bracket the
  94.   string. For example, 4LABCD and L*ABCD* each describe a string of
  95.   length 4 characters. The delimiting character may be any
  96.   character (other than & or ") that does not appear in the string
  97.   itself. The type designation character must be upper case.
  98.  
  99.                     Examples
  100.  
  101.           MOVE.L   #'ABCD',D1
  102.           CMP.W    #1R-,D2        Compare Right Justified Character Data
  103.           DC.L     22H THIS IS A LONG STRING
  104.           DC.B     #Z*SAMPLE ZERO BYTE TERMINATED MESSAGE*
  105.           DC.B     'The End'
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127. MAC.68K                                   -8-
  128. MAC.68K
  129.  
  130.  
  131. II.14 Expression EvaluationII.14 Expression EvaluationII.14 Expression Evaluation
  132.  
  133.  
  134.       Symbols and data values can be combined into expressions
  135.   using normal algebraic notation. A single term expression takes
  136.   on the value of the term involved. Multiple term expressions are
  137.   reduced to a single value following the rules:
  138.  
  139.       Unary operator    +  -
  140.       Binary operator   + - *  /
  141.  
  142.   1. Parenthesized expressions are evaluated from the innermost
  143.      outward.  Parenthesis can be nested to six levels.
  144.  
  145.   2. Arithmetic operators are evaluated left to right, with
  146.      multiplication and division taking precedence over addition
  147.      and subtraction.
  148.  
  149.   3. Each term is evaluated as a 32-bit value.
  150.  
  151.   4. Division yields a 32-bit integer with no remainder, and
  152.      division by zero yields zero, but it is flagged as an error.
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.                               -9-                               MAC.68K
  191.                                                                 MAC.68K
  192.  
  193.  
  194. III.  MACROSIII.  MACROSIII.  MACROS
  195.  
  196.  
  197.       A macro definition contains a sequence of source lines that
  198.   are saved, and then later inserted into the program text when
  199.   referenced by using the macro name as an operation code.
  200.  
  201.       The first line of a macro definition contains the MACRO or
  202.   MACROL operation code, the macro name, and any substitutable
  203.   parameters used within the body of the macro. Reserved macro
  204.   names are:  END ENDM LOCAL ENDD.
  205.  
  206.       Next, a macro definition may optionally contain one or more
  207.   LOCAL pseudo ops that identify symbols used within the body of
  208.   the macro that are local to the macro definition. During macro
  209.   expansion, local symbols are replaced with a symbol name of
  210.   ..hhhh where hhhh is a hex number starting at 0000 and being
  211.   incremented by one each time a local symbol is created. By
  212.   generating unique symbol names, a macro may be expanded more than
  213.   once without causing duplicate symbol definition errors. These
  214.   generated symbol names are not listed in the symbol table and are
  215.   not cross referenced.
  216.  
  217.       The body of the macro comes next. It consists of a sequence
  218.   of source lines terminated by an ENDM operation code. The source
  219.   lines may contain any combination of operation codes, comment
  220.   lines, or macro calls except op code END. By using named ENDM op
  221.   codes (see ENDM) a macro may even contain other macro
  222.   definitions. Note that any macros contained within another macro
  223.   are merely saved and not processed/defined until the outer level
  224.   macro is called.
  225.  
  226.       The name of a substitutable parameter or local symbol can
  227.   occur in any field in a macro body source line. The name is
  228.   recognized if it is bracketed by two of the following macro
  229.   delimiter characters:
  230.  
  231.      space  +  -  *  /  (  )  &  ,  =  "
  232.  
  233.       A macro must be defined prior to its call. A macro defined by
  234.   program source lines (including INCLUDE source lines) is
  235.   considered a user macro.  A macro defined thru inclusion of a
  236.   preassembled macro file (see INCLUDES) is considered a system
  237.   macro. By default MAC.68K does not list either user or system
  238.   macro call expansions. See LIST for the appropriate macro list
  239.   option.
  240.  
  241.  
  242.  
  243.  
  244.  
  245. IV. (deleted)IV.IV.
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253. MAC.68K                                  -10-
  254. MAC.68K
  255.  
  256.  
  257. V.  PROGRAM LIST FORMATS AND LIST CONTROLV.  PROGRAM LIST FORMATS AND LIST CONTROLV.  PROGRAM LIST FORMATS AND LIST CONTROL
  258.  
  259.  
  260.       MAC.68K does not automatically list every line of input to
  261.   the output device.  Each line is categorized by its origin type
  262.   (e.g., a line from an included text file, a line generated by a
  263.   macro, etc) and is listed only if the appropriate list options
  264.   are currently enabled. Pseudo op LIST controls the active list
  265.   options.
  266.  
  267.       Output is formatted either for an 80 column device or a 120
  268.   column device.  The console is assumed to be 80 columns wide and
  269.   everything else 120.  This may be overridden by the PAGE
  270.   initialization pseudo op. When going to an 80 column output
  271.   device, any data characters beyond column 80 are by default
  272.   truncated. When overridden by the OPTION WRAP, columns 81 thru
  273.   120 are printed on the next line beginning in column position
  274.   32.
  275.  
  276.       By default output is paged with a one line header, one blank
  277.   line, and 58 source lines per page. An optional two line header
  278.   format or no header at all may be selected by using OPTION. Lines
  279.   per page may be reset using the PAGE pseudo op. The page line
  280.   fields are:
  281.  
  282.     First header line
  283.  
  284.   columns  1 - 32          64 - 83          88 - 107       112 - 120
  285.           Title           Version #        Date/Time        PAGE nnn
  286.  
  287.     Second header line
  288.  
  289.   columns  1 - 32         64 - 83           88 - 95        112 - 120
  290.        Subtitle          Subheading        QUAL Name
  291.  
  292.     Source line output
  293.  
  294.   columns  1 - 2         3 - 8             9 - 30           31 - 120
  295.        Error Flags    Location Address   Machine Code    Source line
  296.  
  297.  
  298.       In 80 column mode the first header line is compressed by
  299.   dropping the date/time field and replacing it with the page
  300.   number field.
  301.  
  302.       Two optional fields for the source line output are sequence
  303.   numbers and sequence names.  If selected via OPTION, these fields
  304.   are inserted so they end in column 120.  Sequence numbers are not
  305.   always sequential with an assembler that can INCLUDE other text
  306.   files or can generate source lines itself with MACRO or DUP. Each
  307.   INCLUDE file or call to a macro generates a new block of code
  308.   starting with sequence number 1. The old number sequence is
  309.   resumed when the inserted block of code terminates. The optional
  310.   sequence name reflects the source of the code. For source input
  311.   or INCLUDE it is the file name, for macros it is the macro name,
  312.   and for DUP it is DUP**.
  313.  
  314.  
  315.  
  316.                               -11-                              MAC.68K
  317.                                                                 MAC.68K
  318.  
  319.  
  320.       When the console is used as the output device, MAC.68K will
  321.   pause after a page is displayed on the screen and wait for a
  322.   keyboard input character before advancing to the next page.  The
  323.   character *S* or a ctl/C character will immediately terminate the
  324.   assembly. Any other character will cause MAC.68K to continue
  325.   assembling until the next page is full or the assembly is
  326.   complete.  The OPTION NOPAWS will disable the pause feature and
  327.   the output will scroll continuously until the assembly finishes.
  328.   Note that the standard CPM-68K console control keys ctl/S and
  329.   ctl/Q may also be used to stop and continue output.
  330.  
  331.       A printed symbol table must be explicitly requested via an
  332.   OPTION.  OPTION CROSSREF will generate symbol cross references
  333.   and list these symbol references sorted by page and output line
  334.   number when it lists the symbol table.  OPTION SYMBOL will
  335.   generate the same sorted symbol table that lists each symbol and
  336.   its value, but not any cross references.
  337.  
  338.  
  339.  
  340.  
  341. VI.  PROGRAM STRUCTUREVI.  PROGRAM STRUCTUREVI.  PROGRAM STRUCTURE
  342.  
  343.  
  344.       The minimum executable program on the Macintosh is:
  345.  
  346.             ExitToShell          ;RESTART THE FINDER APPLICATION
  347.            .END
  348.  
  349.  
  350.       MAC.68K requires all programs to end with an END card, and to
  351.   optionally begin with an IDENT card.  The IDENT/END pair brackets
  352.   the program text and provides some guarantee of program
  353.   completeness.  Some of the MAC.68K pseudo ops are used only for
  354.   initialization of assembly values, and must appear immediately
  355.   following the IDENT card (if present) but prior to any
  356.   non-initialization operation or pseudo operation code.  These
  357.   pseudo ops are:
  358.        OPTION  MODULE  STEXT  INCLUDES
  359.   If they appear later in the program they are flagged with an
  360.   error and are not processed. Pseudo op PAGE may be used anywhere
  361.   in the program. When used to initialize page width and/or page
  362.   length, it must appear as an initializtion pseudo op.
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379. MAC.68K                                  -12-
  380. MAC.68K
  381.  
  382.  
  383. VII.  FILE NAMES AND EXTENSIONSVII.  FILE NAMES AND EXTENSIONSVII.  FILE NAMES AND EXTENSIONS
  384.  
  385.  
  386.       File names supported by MAC.68K are limited to 8 characters
  387.   in length with an optional extension (a . followed by up to 3
  388.   characters). Imbedded spaces within a file name or extension are
  389.   not supported.  The input source file may have any file
  390.   extension, although .S is recommended. The input file name, the
  391.   object file name specified with the -O command, and the output
  392.   file name specfied with the > command line parameter are the only
  393.   file names that are not assigned explicit file name extensions by
  394.   MAC.68K.
  395.  
  396.       If present, the program name from the IDENT card is used as
  397.   the base file name for the generated object file. Based on
  398.   whether it is a program, module, or definition table assembly the
  399.   object file extension is .68K, .MOD, or .STX .
  400.  
  401.       File names used by the include pseudo ops may optionally
  402.   specify device names and extension names. Included text files are
  403.   assumed to have a blank extension. The extensions .MOD and .STX
  404.   are assumed by INCLUDEH and INCLUDES.
  405.  
  406.       The console is referenced with file name CON:  and the
  407.   printer with name LST:.
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.                               -13-                              MAC.68K 
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.                               -13-